import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

public class ExcelFetcher {
    
    public static List<String> getNameList(String excelFileName) {
        List<String> list = new ArrayList<>();
        try (ExcelReader excelFileReader = ExcelUtil.getReader(excelFileName)) {
            List<Map<String, Object>> maps = excelFileReader.readAll();
            for (int i = 0; i < maps.size(); i++) {
                Map<String, Object> record = maps.get(i);
                if (Objects.nonNull(record) && Objects.nonNull(record.get("学号")) && Objects.nonNull(record.get("年龄"))) {
                    list.add(record.get("姓名").toString());
                }
            }
        }
        return list;
    }
    
}
